package com.ecsolutions.controller.asset;

import com.ecsolutions.entity.asset.DepositCurrencyEntity;
import com.ecsolutions.entity.asset.DepositEntity;
import com.ecsolutions.service.asset.DepositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by Administrator on 2017/5/10.
 */
@RestController
@RequestMapping("/deposit")
public class DepositController {
    @Autowired
    private DepositService depositService;

    public DepositService getDepositService() {
        return depositService;
    }

    @CrossOrigin(origins = "*")
    @GetMapping("/getBalanceOfEachCurrency")
    public List<DepositCurrencyEntity> getBalanceOfEachCurrency(@RequestParam("customer_code") String customer_code) {
        List<DepositCurrencyEntity> ret = null;
        ret = depositService.getBalanceOfEachCurrency(customer_code);
        return ret;
    }

    @CrossOrigin(origins = "*")
    @GetMapping("/getBalanceOfEachAccType")
    public List<DepositCurrencyEntity> getBalanceOfEachAccType(@RequestParam("customer_code") String customer_code, @RequestParam("currency") String currency) {
        List<DepositCurrencyEntity> ret = null;
        ret = depositService.getBalanceOfEachAccType(customer_code, currency);
        return ret;
    }

    @CrossOrigin(origins = "*")
    @GetMapping("/getAssetList/{customer_code}")
    public List<DepositCurrencyEntity> getAssetList(@PathVariable("customer_code") String customer_code) {
        List<DepositCurrencyEntity> ret = null;
        ret = this.depositService.getAssetList(customer_code);
        return ret;
    }

    @CrossOrigin(origins = "*")
    @GetMapping("/getAssets/{customer_code}")
    public DepositEntity getAssets(@PathVariable("customer_code") String customer_code) {
        DepositEntity ret = null;
        ret = this.depositService.getAssets(customer_code);
        return ret;
    }

}
